# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: T.J. Townsend <blakkheim@archlinux.org>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Thorsten Töpper <atsutane-tu@freethoughts.de>

pkgname=vnstat
pkgver=2.11
pkgrel=1
pkgdesc="A console-based network traffic monitor"
arch=('loong64' 'x86_64')
url="https://humdi.net/vnstat/"
license=('GPL')
depends=('bash' 'sqlite')
makedepends=('gd')
optdepends=('gd: image output')
backup=(etc/vnstat.conf)
source=(https://humdi.net/vnstat/$pkgname-$pkgver.tar.gz{,.asc})
sha256sums=('babc3f1583cc40e4e8ffb2f53296d93d308cb5a5043e85054f6eaf7b4ae57856'
            'SKIP')
validpgpkeys=(23EF1DD76E65248FB055201ADAFE84E63D140114) # Teemu Toivola

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --sbindir=/usr/bin --sysconfdir=/etc
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -Dm0755 examples/vnstat.cgi -t "$pkgdir"/usr/share/doc/vnstat/examples
  install -Dm0644 examples/systemd/vnstat.service -t "$pkgdir"/usr/lib/systemd/system
}
